.\" Copyright (c) 1987-2008 - Sun Microsystems, Inc.
.TH gcalctool 1 "1 January 2008"
.SH NAME
gcalctool \- a desktop calculator
.SH SYNOPSIS
.B gcalctool
[
.B -D
] [
.B -E
] [
.B -a
.I accuracy
] [
.B -v
] [
.B \-?
]
.SH DESCRIPTION
.B gcalctool
is a desktop calculator. It has been designed to be used with
either the mouse or the keyboard. It is visually similar to a lot of
hand-held calculators. There are basic, financial and scientific modes.
Some of the calculator keys have menu marks. This indicates that there 
is a menu associated with that key. Each key is discussed in more 
detail below.
.LP
One of the most important things to remember about
.B gcalctool
is that calculations are performed from left to right, with no arithmetic
precedence. If you need arithmetic precedence, then you should use
parentheses (see below).
.LP
Internal arithmetic is now done with multi-precision floating point numbers.
Accuracy can be adjusted from zero to nine numeric places in fixed notation,
but numbers can be displayed in engineering and scientific notation as well.
There is also an option to show or remove trailing zeroes after the numeric
point.
The calculator reverts to scientific notation when the number is larger than
the display would allow in fixed notation. In the scientific mode, the base 
of operation can be changed between binary, octal, decimal and hexadecimal.
Numbers are initially displayed in fixed notation to nine numeric places,
with trailing zeroes removed, in the decimal base.
.LP
You can use the
.I Copy
and
.I Paste
functions in conjunction with the numeric display to store or
retrieve characters from the clipboard. You can also remove the last digit
entered, completely clear the displayed entry and totally reset the 
calculator.
.LP
There are ten memory registers. Numbers can be stored or retrieved in these
locations, and arithmetic can be performed upon register contents.
.LP
On startup,
.B gcalctool
will use several configuration resources stored in a 
.I gconf
database. These are listed in detail in the resources section of these 
manual pages. Any constants or function definitions that the user defines are
also stored in this database.
.LP
Context sensitive help is also available. Control-F1 toggles whether
tooltip help is displayed for the item which currently has focus.
.SH OPTIONS
.TP
.B \-D
Turning on gcalctool debugging.
.TP
.B \-E
Turning on debugging in the multiple precision arithmetic package.
.TP
.BI \-a " accuracy"
Initial number of digits displayed after the numeric point. This value must
be in the range 0 to 9. The default is nine numeric places.
.TP
.B \-v
Show the version number and the usage message of this release of the
.B gcalctool
program.
.TP
.B \-?
Show the version number and the usage message of this release of the
.B gcalctool
program. Note that the
.B ?
character must be escaped if using
.BR csh (1).
.SH RESOURCES
On startup,
.B gcalctool
uses the following string type resources stored in a 
.I gconf
database:
.TP 15
.PD 0
.B Resource:
/schemes/apps/gcalctool/accuracy
.TP
.B Values:
Accuracy value
.TP
.B Description
The number of of digits displayed after the numeric point. This value must
be in the range 0 to 9.
.sp
.TP
.B Resource:
/schemes/apps/gcalctool/base
.TP
.B Values:
Numeric Base
.TP
.B Description
The initial numeric base. Valid values are "BIN" (binary), "OCT" (octal), 
"DEC" (decimal) and "HEX" (hexadecimal).
.sp
.TP
.B Resource:
/schemes/apps/gcalctool/display
.TP
.B Values:
Display mode
.TP
.B Description
The initial display mode. Valid values are "ENG" (engineering), "FIX"
(fixed-point) and "SCI" (scientific).
.sp
.TP
.B Resource:
/schemes/apps/gcalctool/mode
.TP
.B Values:
Mode
.TP
.B Description
The initial calculator mode. Valid values are "BASIC", "FINANCIAL"
and "SCIENTIFIC".
.sp
.TP
.B Resource:
/schemes/apps/gcalctool/showzeroes
.TP
.B Values:
true, false (true)
.TP
.B Description
Whether trailing zeroes, after the numeric point, are shown in the
display value.
.sp
.TP
.B Resource:
/schemes/apps/gcalctool/showthousands
.TP
.B Values:
true, false (false)
.TP
.B Description
Whether fixed numbers in the decimal base are displayed with thousands
separated.
.sp
.TP
.B Resource:
/schemes/apps/gcalctool/showregisters
.TP
.B Values:
true, false (true)
.TP
.B Description
Whether the memory register window is initially displayed.
.sp
.TP
.B Resource:
/schemes/apps/gcalctool/trigtype
.TP
.B Values:
Trig. type
.TP
.B Description
The initial trigonometric type. Valid values are "DEG" (degrees), 
"GRAD" (grads) and "RAD" (radians).
.sp
.SH MENU BAR
.PD
.LP
This section describes the menu items available in the applications menubar.
.SS Calculator Menu
.LP
.PD 0
.IP "\fBQuit	[ Control-Q ]\fP" 18
Exit without user verification.
.SS Edit Menu
.LP
.PD 0
.IP "\fBCopy	[ Control-C ]\fP" 18
Copy the calculators numeric display to the clipboard.
.IP "\fBPaste	[ Control-V ]\fP" 18
Paste the contents of the clipboard into the calculators numeric display.
.IP "\fBInsert ASCII Value	[ Control-I ]\fP" 18
A separate window is displayed which allows you to enter any character. 
The ASCII value of this character is then displayed in the current base.
.SS View Menu
.LP
.PD 0
.IP "\fBBasic Mode    [ Control-B ]\fP" 18
Display the calculator in basic mode.
.IP "\fBFinancial Mode    [ Control-F ]\fP" 18
Display the calculator in financial mode.
.IP "\fBScientific Mode    [ Control-S ]\fP" 18
Display the calculator in scientific mode.
.IP "\fBMemory Registers    [ Control-M ]\fP" 18
Display the memory registers window.
.SS Help Menu
.LP
.PD 0
.IP "\fBContents...    [ F1 ]\fP" 18
Display the online help for the calculator in a separate window.
.IP "\fBAbout Gcalctool    [ Control-A ]\fP" 18
Display information about this application, including the version number
and the author.
.SH CALCULATOR BUTTONS
.PD
.LP
This section describes the calculator keys present in the main
.B gcalctool
window. 
.B gcalctool
has three modes; basic, financial and scientific. The keys associated with
each of these modes are described in separate sections below.
.LP
Keyboard equivalents appear in the square brackets. Note that Alt followed
by a letter indicates that the Alt key and this key should be pressed
together.
.SH BASIC MODE
.LP
.PD
.SS "Numerical Keys [ 0-9 . = <Return> ]."
.LP
Enter a digit (decimal digits 0-9) into the display. The '.' character acts 
as the numeric point, and '=' (or Return) is used to complete numerical entry.
.LP
Upto forty digits may be entered.
.SS "Arithmetical Operations [ + - x * / ]."
.LP
Perform an arithmetical operation using the previous entry and the next entry
as operands. Addition, subtraction, multiplication and division are denoted by
the characters '+', '-', '*' and '/' respectively ('x' is also synonymous with
multiplication).
.SS Number Manipulation Operators.
.LP
.PD 0
.IP "\fBInt	[ i ]\fP" 18
Return the integer portion of the current entry.
.IP "\fBFrac	[ : ]\fP" 18
Return the fractional portion of the current entry.
.IP "\fBAbs	[ u ]\fP" 18
Return the absolute value of the current entry.
.IP "\fB+/-	[ C ]\fP" 18
Change the arithmetic sign of the current entry.
.IP "\fB1/x	[ r ]\fP" 18
Return the value of 1 divided by the current entry.
.IP "\fBx^2	[ @ ]\fP" 18
Return the square of the current entry.
.IP "\fB%	[ % ]\fP" 18
Perform a percentage calculation using the last entry and the next entry.
.IP "\fBSqrt	[ s ]\fP" 18
Perform a square root operation on the current entry.
.PD
.SS Menu Operations.
.LP
Each of these operations has a popup menu associated with it.
It is also possible to use just the keyboard to achieve the same results.
The first keyboard value selects the menu operation; the second keyboard
character selects the new value for this operation. Unlike the menu facility
available with the mouse, there is no visual feedback on what choices are
available to you, so the user has to know what item they wish to select.
.PD 0
.IP "\fBAcc	[ A ]\fP" 18
Set the display accuracy. Between 0 and 9 [ 0-9 ] significant digits can be
displayed.
.IP "\fBRcl	[ R ]\fP" 18
Retrieve memory register value. There are ten memory registers [\ 0-9\ ].
.IP "\fBSto	[ S ]\fP" 18
Store value in memory register. There are ten memory registers [\ 0-9\ ].
The register number may be preceded by an arithmetic operation (addition,
subtraction, multiplication or division), in which case the specified
operation is carried out between the displayed entry and the value currently
in the selected memory register, and the result is placed in the memory
register.
.IP "\fBExch	[ X ]\fP" 18
Exchange the current display with the contents of a memory register. There
are ten memory registers [ 0-9 ].
.SS Other Operations.
.LP
.IP "\fBClr	[ Delete ]\fP" 18
Clear the display, and reset the calculator.
.IP "\fBCE	[ Control-Back Space or Escape ]\fP" 18
Clear the display.
.IP "\fBBksp	[ Back Space ]\fP" 18
Remove the rightmost character of the current entry, and recalculate the
displayed value.
.PD
.SH FINANCIAL MODE
.LP
An example of how to use each of these financial calculations, is available
via the tooltip help facility.
.PD 0
.IP "\fBCtrm	[ m ]\fP" 18
Compounding term. Computes the number of compounding periods it will take an
investment of present value pv to grow to a future value of fv, earning a
fixed interest rate int per compounding period.
.PD
.br
Memory register usage:
.br
Register 0	int	(periodic interest rate).
.br
Register 1	fv	(future value).
.br
Register 2	pv	(present value).
.IP "\fBDdb	[ D ]\fP" 18
Double-declining depreciation. Computes the depreciation allowance on an
asset for a specified period of time, using the double-declining balance
method.
.br
Memory register usage:
.br
Register 0	cost	(amount paid for asset).
.br
Register 1	salvage	(value of asset at end of life).
.br
Register 2	life	(useful life of the asset).
.br
Register 3	period	(time period for depreciation allowance).
.IP "\fBFv	[ v ]\fP" 18
Future value. This calculation determines the future value of an investment.
It computes the future value based on a series of equal payments, each of
amount pmt, earning periodic interest rate int, over the number of payment
periods in term.
.br
Memory register usage:
.br
Register 0	pmt	(periodic payment).
.br
Register 1	int	(periodic interest rate).
.br
Register 2	n	(number of periods).
.IP "\fBPmt	[ P ]\fP" 18
Periodic payment. Computes the amount of the periodic payment of a loan.
Most installment loans are computed like ordinary annuities, in that payments
are made at the end of each payment period.
.br
Memory register usage:
.br
Register 0	prin	(principal).
.br
Register 1	int	(periodic interest rate).
.br
Register 2	n	(term).
.IP "\fBPv	[ p ]\fP" 18
Present value. Determines the present value of an investment. It computes
the present value based on a series of equal payments, each of amount pmt,
discounted at periodic interest rate int, over the number of periods in term.
.br
Memory register usage:
.br
Register 0	pmt	(periodic payment).
.br
Register 1	int	(periodic interest rate).
.br
Register 2	n	(term).
.IP "\fBRate	[ T ]\fP" 18
Periodic interest rate. Returns the periodic interest necessary for a present
value of pv to grow to a future value of fv over the number of compounding
periods in term.
.br
Memory register usage:
.br
Register 0	fv	(future value).
.br
Register 1	pv	(present value).
.br
Register 2	n	(term).
.IP "\fBSln	[ l ]\fP" 18
Straight-line depreciation. Computes the straight-line depreciation of an
asset for one period. The straight-line method of depreciation divides the
depreciable cost (cost - salvage) evenly over the useful life of an asset.
The useful life is the number of periods (typically years) over which an
asset is depreciated.
.br
Memory register usage:
.br
Register 0	cost	(cost of the asset).
.br
Register 1	salvage	(salvage value of the asset).
.br
Register 2	life	(useful life of the asset).
.IP "\fBSyd	[ Y ]\fP" 18
Sum-of-the-years-digits depreciation. The sum-of-the-years'-digits method
of depreciation accelerates the rate of depreciation, so that more
depreciation expense occurs in earlier periods than in later ones. The
depreciable cost is the actual cost minus salvage value. The useful life is
the number of periods (typically years) over which an asset is depreciated.
.br
Memory register usage:
.br
Register 0	cost	(cost of the asset).
.br
Register 1	salvage	(salvage value of the asset).
.br
Register 2	life	(useful life of the asset).
.br
Register 3	period	(period for which depreciation is computed).
.IP "\fBTerm	[ t ]\fP" 18
Payment period. Returns the number of payment periods in the term of an
ordinary annuity necessary to accumulate a future value of fv, earning a
periodic interest rate of int. Each payment is equal to amount pmt.
.br
Memory register usage:
.br
Register 0	pmt	(periodic payment).
.br
Register 1	fv	(future value).
.br
Register 2	int	(periodic interest rate).
.PD
.SH SCIENTIFIC MODE
.PD
.LP
This section describes the functionality available in the calculators
scientific mode. This also includes a special mode panel used for setting
various options.
.SS Mode Panel.
.LP
.PD
.IP "\fBNumeric Base\fP" 18
Set the numeric base of operation. Choices are binary, octal, decimal (the
default) and hexadecimal.
.IP "\fBDisplay Type\fP" 18
Set the display mode. Valid values are "Eng" (engineering), "Fix"
(fixed-point) and "Sci" (scientific).
.IP "\fBTrigonometric Type\fP" 18
Set the trigonometric type. Valid values are Degrees, Gradians and Radians.
.IP "\fBHyp\fP" 18
Toggle the hyperbolic function indicator. This switch affects the type of
sine, cosine and tangent trigonometric functions performed.
.IP "\fBInv\fP" 18
Toggle the inverse function indicator. This switch affects the type of sine,
cosine and tangent trigonometric functions performed.
.PD
.SS Menu Operations.
.LP
.PD 0
.IP "\fBCon	[ # ]\fP" 18
Retrieve and display a constant value. There are ten constant values [ 0-9 ],
and each one has a default value which can be overridden when the user creates
their own constant definitions. The ten default values are:
.sp
0	0.621		kilometers per hour or miles per hour
.br
1	1.414213562	square root of 2
.br
2	2.718281828	e
.br
3	3.141592653	pi
.br
4	0.3937007	centimeters or inches
.br
5	57.295779513	degrees in a radian
.br
6	1048576.0	2 to the power of 20
.br
7	0.0353		grams or ounces
.br
8	0.948		kilojoules or British thermals
.br
9	0.0610		cubic centimeters or cubic inches
.IP "\fBFun	[ F ]\fP" 18
Retrieve and execute a function expression. There can be upto ten functions
expression defined by the user [0 - 9]. There are no default function values.
.PD
.SS Scientific buttons.
.PD 0
.LP
.IP "\fB<	[ < ]\fP" 18
Shift the current entry to the left. The shift can be between 1 and 15 places
[ 1-9, A-F ]. This calculator key has a popup menu associated with it.
.IP "\fB>	[ > ]\fP" 18
Shift the current entry to the right. The shift can be between 1 and 15 places
[ 1-9, A-F ]. This calculator key has a popup menu associated with it.
.IP "\fB&16	[ ] ]\fP" 18
Truncate the current entry to a 16 bit unsigned integer.
.IP "\fB&32	[ [ ]\fP" 18
Truncate the current entry to a 32 bit unsigned integer.
.IP "\fB( and ) [ ( and ) ]\fP" 18
Parentheses. Allow precedence with arithmetic calculations. Note that
parentheses can be nested to any level, and
.B gcalctool
provides a visual feedback of what is being typed in, in the calculator
display. The calculation doesn't take place until the last parenthesis is
matched, then the display is updated with the new result.
.IP "\fBExp	[ E ]\fP" 18
This is used to allow numbers to be entered in scientific notation. The
mantissa should be initially entered, then the Exp key selected. The exponent
is then entered. If no numerical input had occurred when the Exp key was
selected, then a mantissa of 1.0 is assumed.
.IP "\fBe^x	[ { ]\fP" 18
Returns e raised to the power of the current entry.
.IP "\fB10^x	[ } ]\fP" 18
Returns 10 raised to the power of the current entry.
.IP "\fBy^x	[ y ]\fP" 18
Take the last entry and raise it to the power of the next entry.
.IP "\fBx!	[ ! ]\fP" 18
Return the factorial of the current entry. Note that the factorial function
is only valid for positive integers.
.IP "\fBRand	[ ? ]\fP" 18
Return a random number between 0.0 and 1.0.
.IP "\fBHexadecimal Keys [ a-f ]\fP" 18
The hexadecimal numerical digits A-F. These buttons will be insensitive 
unless the calculator is currently in the hexadecimal mode. They will be
shown in upper-case in the calculator display.
.IP "\fBCos	[ J ]\fP" 18
Return the trigonometric cosine, arc cosine, hyperbolic cosine or inverse
hyperbolic cosine of the current display, depending upon the current
settings of the hyperbolic and inverse function switches. The result is
displayed in the current trigonometric units (degrees, radians or grads).
.IP "\fBSin	[ K ]\fP" 18
Return the trigonometric sine, arc sine, hyperbolic sine or inverse
hyperbolic sine of the current display, depending upon the current settings
of the hyperbolic and inverse function switches. The result is displayed in
the current trigonometric units (degrees, radians or grads).
.IP "\fBTan	[ L ]\fP" 18
Return the trigonometric tangent, arc tangent, hyperbolic tangent or inverse
hyperbolic tangent of the current display, depending upon the current
settings of the hyperbolic and inverse function switches. The result is
displayed in the current trigonometric units (degrees, radians or grads).
.IP "\fBLn	[ N ]\fP" 18
Return the natural logarithm of the current entry.
.IP "\fBLog10	[ G ]\fP" 18
Return the base 10 logarithm of the current entry.
.IP "\fBLog2	[ H ]\fP" 18
Return the base 2 logarithm of the current entry.
.IP "\fBOR	[ | ]\fP" 18
Perform a logical OR operation on the current entry and the next entry,
.IP "\fBAND	[ & ]\fP" 18
Perform a logical AND operation on the current entry and the next entry,
treating both numbers as unsigned long integers.
.IP "\fBNOT	[ ~ ]\fP" 18
Perform a logical NOT operation on the current entry.
.IP "\fBXOR	[ ^ ]\fP" 18
Perform a logical XOR operation on the current entry and the next entry,
treating both numbers as unsigned long integers.
.IP "\fBXNOR	[ n ]\fP" 18
Perform a logical XNOR operation on the current entry and the next entry,
treating both numbers as unsigned long integers.
.PD
.SH FILES
.PD 0
.TP 18
.B ~/.gcalctoolrc
user's personal gcalctool resources for customizing the appearance and color of
.B gcalctool
.sp
.LP
